package com.javafamily.familydemo.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel(value = "提供一个备用名")
public class Response {
    @ApiModelProperty(value="判断请求是否成功")
    private boolean isok;
    @ApiModelProperty(value="状态码")
    private int code;
    @ApiModelProperty(value="信息描述")
    private String message;
    @ApiModelProperty(value="返回数据")
    private Object data;

    public Response() {
    }

    public static Response success() {
        Response response = new Response();
        response.setIsok(true);
        response.setCode(200);
        response.setMessage("success!");
        return response;
    }

    public static Response success(Object obj) {
        Response response = new Response();
        response.setIsok(true);
        response.setCode(200);
        response.setMessage("success!");
        response.setData(obj);
        return response;
    }

    public static Response success(Object obj, String message) {
        Response response = new Response();
        response.setIsok(true);
        response.setCode(200);
        response.setMessage(message);
        response.setData(obj);
        return response;
    }
}
